package com.atguigu.service.impl;

import com.atguigu.entity.Article;
import com.atguigu.entity.User;
import com.atguigu.feign.ArticleFeignClient;
import com.atguigu.mapper.UserMapper;
import com.atguigu.service.UserService;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private ArticleFeignClient articleFeignClient;


    @Override
    public User getUserArticle(Integer userId) {
        User user = getById(userId);
        List<Article> articleList = articleFeignClient.queryArticleList(user.getUserId());
        user.setArticleList(articleList);
        return user;

    }
}
